<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="utf-8">
	<title>layuiAdmin 后台管理员</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" th:href="@{/layuiadmin/layui/css/layui.css}" media="all">
	<link rel="stylesheet" th:href="@{/layuiadmin/style/admin.css}" media="all">
	<style>
		table {
			margin-left: 50px;
			margin-right: 50px;
		}
	</style>
</head>

<body>
<div class="layui-fluid">
	<div class="layui-card">
		<form action="" id="searchForm">
			<div class="layui-form layui-card-header layuiadmin-card-header-auto">
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">订单ID</label>
						<div class="layui-input-block">
							<input type="text" name="loanGid" placeholder="请输入loanGid" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<button type="button" class="layui-btn layui-btn-primary" lay-submit lay-filter="search" id="search">
							<i class="layui-icon  layui-icon-search layuiadmin-button-btn"></i>
						</button>
					</div>
				</div>
			</div>
		</form>
		借款订单记录表[record_loan]
		<table class="layui-hide" lay-filter="recordLoan" id="recordLoan"></table>
		<br/>
		打款日志记录表[trans_withdraw]
		<table class="layui-hide" lay-filter="transWithdraw" id="transWithdraw"></table>
		<br/>
		还款记录表[record_repayment]
		<table class="layui-hide" lay-filter="recordRepayment" id="recordRepayment"></table>
		<br/>
		还款计划表[record_repayment_plan]
		<table class="layui-hide" lay-filter="recordRepaymentPlan" id="recordRepaymentPlan"></table>
		<br/>
		还款日志记录表[trans_deduction]
		<table class="layui-hide" lay-filter="transDeduction" id="transDeduction"></table>
	</div>
</div>

<script th:src="@{/layuiadmin/layui/layui.js}"></script>

<script>
	// 借款记录
	layui.use('table', function () {
		var $ = layui.$;
		var table = layui.table;
		var form = layui.form;
		//借款
		table.render({
			// 表格容器ID
			elem: '#recordLoan'
			// 表格ID，必须设置，重载部分需要用到
			, id: 'recordLoan'
			, title: '借款记录表'
			, text: {
				none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
			}
			, skin: 'line' //行边框风格
			, even: true //开启隔行背景
			, size: 'sm' //小尺寸的表格
			, loading: false
			, cols: [
				[
					,{field: 'gid', title: 'gid', width:80, sort: true, fixed: 'left'}
					,{field: 'loanTime', title: '借款时间', width:80}
					,{field: 'productPeriod', title: '期数', width:80}
					,{field: 'loanAmount', title: '应还本金（分）', width:80}
					,{field: 'loanTotalAmount', title: '应还总金额（分）', width:80}
					,{field: 'loanFee', title: '手续费（分）', width:80}
					,{field: 'loanInterest', title: '利息（分）', width:80}
					,{field: 'loanOverdueFee', title: '逾期费（分）', width:80}
					,{field: 'repaymentAmount', title: '已还金额（分）', width:80}
					,{field: 'repaymentStatus', title: '还款状态', width:80}
					,{field: 'loanRate', title: '年华利率', width:80}
					,{field: 'feeType', title: '计息方式', width:80}
					,{field: 'status', title: '借款状态', width:80}
				]
			]
		});
		//还款
		table.render({
			// 表格容器ID
			elem: '#recordRepayment'
			// 表格ID，必须设置，重载部分需要用到
			, id: 'recordRepayment'
			, title: '还款记录表'
			// 分页 curr起始页，groups连续显示的页码，默认每页显示的条数
			, text: {
				none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
			}
			, skin: 'line' //行边框风格
			, even: true //开启隔行背景
			, size: 'sm' //小尺寸的表格
			, loading: false
			, cols: [
				[
					{field: 'gid', title: 'gid', width:80, sort: true, fixed: 'left'}
					,{field: 'repaymentPlanGid', title: 'repaymentPlanGid', width:80}
					,{field: 'repaymentType', title: '还款类型', width:80}
					,{field: 'repaymentWay', title: '还款方式', width:80}
					,{field: 'bankCardGid', title: 'bankCardGid', width:80}
					,{field: 'repaymentAmount', title: '还款金额', width:80}
					,{field: 'repaymentCapital', title: '还款本金', width:80}
					,{field: 'repaymentFee', title: '服务费', width:80}
					,{field: 'repaymentInterest', title: '利息', width:80}
					,{field: 'repaymentOverdueFee', title: '逾期费', width:80}
					,{field: 'repaymentStatus', title: '还款状态', width:80}
					,{field: 'DeductionGid', title: 'DeductionGid', width:80}
					,{field: 'failReason', title: '还款失败原因', width:80}
				]
			]
		});
		//还款计划
		table.render({
			// 表格容器ID
			elem: '#recordRepaymentPlan'
			// 表格ID，必须设置，重载部分需要用到
			, id: 'recordRepaymentPlan'
			, title: '还款记录表'
			// 分页 curr起始页，groups连续显示的页码，默认每页显示的条数
			, text: {
				none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
			}
			, skin: 'line' //行边框风格
			, even: true //开启隔行背景
			, size: 'sm' //小尺寸的表格
			, loading: false
			, cols: [
				[
					{field: 'gid', title: 'gid', width:80, sort: true, fixed: 'left'}
					,{field: 'currentPeriod', title: '当前还款期数', width:80}
					,{field: 'needRepaymentAmount', title: '本期应还总金额', width:80}
					,{field: 'needRepaymentCapital', title: '本期应还本金', width:80}
					,{field: 'needRepaymentFee', title: '本期应还服务费', width:80}
					,{field: 'needRepaymentInterest', title: '本期应还利息', width:80}
					,{field: 'needRepaymentOverdueFee', title: '本期逾期费', width:80}
					,{field: 'status', title: '本期还款状态', width:80}
					,{field: 'repaymentAmount', title: '本期应还总金额', width:80}
					,{field: 'repaymentCapital', title: '本期应还本金', width:80}
					,{field: 'repaymentFee', title: '本期应还服务费', width:80}
					,{field: 'repaymentInterest', title: '本期应还利息', width:80}
					,{field: 'repaymentOverdueFee', title: '本期逾期费', width:80}
					,{field: 'dueStatus', title: '是否逾期', width:80}
				]
			]
		});
		//打款记录
		table.render({
			// 表格容器ID
			elem: '#transWithdraw'
			// 表格ID，必须设置，重载部分需要用到
			, id: 'transWithdraw'
			, title: '还款记录表'
			// 分页 curr起始页，groups连续显示的页码，默认每页显示的条数
			, text: {
				none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
			}
			, skin: 'line' //行边框风格
			, even: true //开启隔行背景
			, size: 'sm' //小尺寸的表格
			, loading: false
			, cols: [
				[
					{field: 'gid', title: 'gid', width:80, sort: true, fixed: 'left'}
					,{field: 'withdrawAmount', title: '打款金额', width:80}
					,{field: 'withdrawStatus', title: '打款状态', width:80}
					,{field: 'withdrawOrderId', title: '渠道流水号', width:80}
					,{field: 'returnCode', title: '渠道返回业务结果', width:80}
					,{field: 'returnMsg', title: '渠道返回业务描述', width:80}

				]
			]
		});
		//还款记录
		table.render({
			// 表格容器ID
			elem: '#transDeduction'
			// 表格ID，必须设置，重载部分需要用到
			, id: 'transDeduction'
			, title: '还款记录表'
			// 分页 curr起始页，groups连续显示的页码，默认每页显示的条数
			, text: {
				none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
			}
			, skin: 'line' //行边框风格
			, even: true //开启隔行背景
			, size: 'sm' //小尺寸的表格
			, loading: false
			, cols: [
				[
					{field: 'gid', title: 'gid', width:80, sort: true, fixed: 'left'}
					,{field: 'deductionAmount', title: '扣款金额', width:80}
					,{field: 'deductionStatus', title: '扣款状态', width:80}
					,{field: 'deductionType', title: '扣款类型', width:80}
					,{field: 'deductionOrderId', title: '渠道流水号', width:80}
					,{field: 'returnCode', title: '渠道返回业务结果编号', width:80}
					,{field: 'returnMsg', title: '渠道返回业务结果描述', width:80}
					,{field: 'receiptUrl', title: '银行电子回单url', width:80}
					,{field: 'description', title: '描述', width:80}
				]
			]
		});

		//搜索
		form.on('submit(search)', function(data){
			var field = data.field;
			//借款
			table.reload('recordLoan', {
				url: "/grape/order/getRecordLoanList",
				// 附加参数，post token
				contentType: 'application/json',
				where: field,
				method:'post'
				, title: '借款记录表'
			});
			//还款
			table.reload('recordRepayment', {
				url: "/grape/order/getRecordRepaymentList",
				// 附加参数，post token
				contentType: 'application/json',
				where: field,
				method:'post'
			});
			//还款计划
			table.reload('recordRepaymentPlan', {
				url: "/grape/order/getRecordRepaymentPlanList",
				// 附加参数，post token
				contentType: 'application/json',
				where: field,
				method:'post'
			});
			//打款记录
			table.reload('transWithdraw', {
				url: "/grape/order/getTransWithdrawList",
				// 附加参数，post token
				contentType: 'application/json',
				where: field,
				method:'post'
			});
			//还款记录
			table.reload('transDeduction', {
				url: "/grape/order/getTransDeductionList",
				// 附加参数，post token
				contentType: 'application/json',
				where: field,
				method:'post'
			});

		});

	});

</script>
</body>
</html>

